#include <stdio.h>
#include <math.h>

int isPrime(int n)
{
	if (n==2 || n==3 || n==5 || n==7)return 1;
	if (n%2 == 0 || n%3== 0 || n==1)return 0;
	int i;
	for (i=5; i<=floor(sqrt(n)); i+=6) {
		if (n%i== 0 || n%(i+2)== 0)return 0;
	}
	return 1;
}

int main()
{
	int len, sum, p=1, i;
	float pcounter=0, counter=1;
	for (len=3; ; len+=2) {
		i = 4;
		while (i) {
			p = len-1+p;
			if (isPrime(p))pcounter++;
			i--;
		}
		counter+=4;
		//printf("%f ", counter);
		if (pcounter/counter <0.1)break;		
	}
	printf("%d\n", len);
}
